package com.xiaofang.controller.indexcontrolelr;

import com.xiaofang.pojo.User;
import com.xiaofang.serivce.UserSerivc;
import com.xiaofang.utils.Ajax;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @program: xiaofangbackend
 * @ClassName RegController
 * @description:
 * @author: aodi
 * @create: 2025-06-20 14:38
 * @Version 1.0
 */
@RestController
@RequestMapping("/xiaofang/reg")
public class RegController {

    @Autowired
    private UserSerivc  userSerivc ;

//     注册用户
    @PostMapping("/regUser")
    public Ajax regUser(@RequestBody User user) {
        try {
            Integer i = userSerivc.regUser(user);
        } catch (Exception e) {
            e.printStackTrace();
            return new Ajax("500","用户已存在");
        }
        return new Ajax("200","注册成功");
    }

}
